let http = require('http')
let data = [
  {
    name: 'name11',
    id: '11'
  },
  {
    name: 'name22',
    id: '22'
  },
  {
    name: 'name33',
    id: '33'
  },
]
let server = http.createServer((req, res) =>  {
  console.log(req.method, req.url);
  if(req.url == '/api/users') {
    res.setHeader('Access-Control-Allow-Origin','*')
    res.end(JSON.stringify(data))
  }else {
    res.end("Not Found")
  }
})

server.listen(3001, () => {
  console.log('服务端运行在3001端口上')
})